import scripts.cell_env

vars = Variables('variables.cache')
vars.AddVariables(
    EnumVariable('configuration', 'Build configuration', 'release', ['debug', 'release']),
    EnumVariable('target',        'Target platform',     'cell',    ['cell', 'cell-ps3'])
)
e = Environment(variables = vars, tools = [])
Help(vars.GenerateHelpText(e))
print vars.GenerateHelpText(e)

variant_dir = '.build/%s' % e['configuration']

if e['target'] in ['cell', 'cell-ps3']:
    ppe_env = scripts.cell_env.configureEnv(configuration = e['configuration'], target = e['target'])
    spe_env = scripts.cell_env.configureSpeEnv(configuration = e['configuration'], target = e['target'])
else:
    assert False, 'target %s not supported :(' % e['target']

ppe_env.AppendUnique(CPPPATH = [
    '.',
    '#/NanoFlowVis',
])
spe_env.AppendUnique(CPPPATH = [
    '#/.',
])
scripts.cell_env.addEmbedBuilder(spe_env)

if e['target'] == 'cell-ps3':
    ppe_env.AppendUnique(CPPDEFINES = [
        '__PS3__',
    ])
    

p = SConscript('SConscript', exports = ['spe_env', 'ppe_env'], variant_dir = variant_dir, duplicate = 0)
#p = SConscript('orig.SConscript', exports = ['spe_env', 'ppe_env'], variant_dir = variant_dir, duplicate = 0)

vars.Save('variables.cache', e)

Default(p)
